package ${packageOutPath!""}.api.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import ${packageOutPath}.vo.${bean}Vo;

@Service
public class M${bean}Service {
	
	/**
	 * 格式化列表
	 * @param list
	 * @return
	 * @ChangeLog
	 *
	 */
	public List<Map<String, String>> formatList(List<${bean}Vo> list){
		List<Map<String, String>> resList = new ArrayList<Map<String,String>>() ;
		for(${bean}Vo bean : list){
			resList.add(formatBean(bean)) ;
		}
		return resList ;
	}
	
	/**
	 * 格式化
	 * @param bean
	 * @return
	 * @ChangeLog
	 *
	 */
	public Map<String, String> formatBean(${bean}Vo bean){
		Map<String, String> map = new HashMap<String, String>() ;
	
	<#list fields?keys as fieldKey>
   	<#list listCaptions?keys as captionsKey>
   	<#if captionsKey==fieldKey>
		map.put("${fieldKey}", CyUtil.getString(${fields[fieldKey]!("null")}()));//${listCaptions[captionsKey]!""}
	</#if>
	</#list>
	</#list>
		return map ;
	}
	
	
	private Log log = LogFactory.getLog(M${bean}Service.class) ;
	
}
